Learn R Programming

metRology (version 0.9-29-2)

boot.mtr.pairwise : Parametric bootstrap for pairwise comparison statistics.

Description

Generates a parametric bootstrap for the pair-difference chi-squared statistic or MSD.

boot.mtr.pairwise is primarily intended to be called from other functions, notably bootPDchisq.

Usage

boot.mtr.pairwise(x, s=mad , B=3000, probs=c(0.95, 0.99), 
		cov=NULL, cor = NULL, stat=c("MSD", "PDchisq"), 
		method=c("rnorm", "lhs"), keep=FALSE, labels=names(x), ...)

Value

An object of class “bootMtrPairs”, consisting of a list containing: of length length(x) of median scaled absolute deviations for each observation, with attributes:

t0

vector of values calculated by msd or pdchisq

labels

character vector of labels, by default taken from x

probs

vector of probabilities supplied and used for quantiles

critical.values

matrix of quantiles. Each row corresponds to a probability in probs and each column to an individual data point.

pvals

p-values estimated as the observed proportion of simulated values exceeding the calculated values t0.

B

Number of bootstrap replicates used.

method

The sampling method used by the parametric bootstrap.

stat

The statistic bootstrapped. Either "MSD" or "PDchisq" for msd or pdchisq, respectively.

t

If keep=TRUE, the individual bootstrap replicates generated by msd or pdchisq. t is set to NA if keep=FALSE

.

Summary, print and plot methods are provided for the class; see bootMtrPairs-class.

Arguments

x

Vector of observations

s

Either a function returning an estimate of scale for x or a vector of length length(x) of standard errors or standard uncertainties in x.

B

Scalar number of bootstrap replicates.

probs

Vector of probabilities at which to calculate upper quantiles. Passed to quantile.

cov, cor

Covariance or correlation matrix, respectively, describing the covariance structure across x. Passed to pdchisq.

stat

The statistic to be bootstrapped. Either "MSD" or "PDchisq" for msd or pdchisq, respectively.

method

Character value describing the simulation method.

keep

If keep == TRUE the individual bootstrap replicates are retained.

labels

Character vector of labels for individual values.

...

Parameters passed to other methods.

Author

S. L. R. Ellison s.ellison@lgcgroup.com

Details

boot.mtr.pairwise calculates a parametric bootstrap simulation (or Monte carlo simulation) of the results of msd or pdchisq applied to data. This allows individual case-specific quantiles and p-values to be estimated that allow for different standard errors (or standard uncertainties) s.

The sampling method is currently sampling from rnorm.

Individual upper quantiles for probabilities probs and p-values are estimated directly from the bootstrap replicates. Quantiles use quantile. p-values are estimated from the proportion of replicates that exceed the observed values calculated by msd or pdchisq. Note that the print method for the summary object does not report zero proportions as identically zero.

See Also

msd, bootMSD-class, pdchisq, PDchisq-class,

Examples

Run this code

  data(Pb)
  if (FALSE) {
  #Default method:
  set.seed(1023)
  boot.Pb.default <- boot.mtr.pairwise(Pb$value, Pb$u)  # Uses individual standard uncertainties
  summary(boot.Pb.default)
  
  
  #Method for pair-difference chi-squared object:
  pwch.Pb<-pdchisq(Pb$value, Pb$u)  # Uses individual standard uncertainties
  boot.Pb <- boot.mtr.pairwise(pwch.Pb, B=5000)
  	#Increased replication compared to default
  summary(boot.Pb)
  
  # NOTE: The default summary gives individual observation p-values. 
  # To correct for multiple comparisons, apply 
  # a suitable p-value adjustment; for example:
  summary(boot.Pb, p.adjust="holm")

  }


Run the code above in your browser using DataLab